package me.boot.sys.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import me.boot.db.mybatis.interceptor.foreign.ForeignKey;
import me.boot.db.mybatis.template.entity.AutoEntity;
import me.boot.gen.table.annotation.ColumnComment;

/**
 * 系统字典表
 * <p>
 * 1、字典分为全局字典与公司字典，当 companyId = null 或 companyId = 0 时 为全局字典
 * 2、组合约束字段：companyId + code
 * 3、根据约定的code查询字典，查询顺序：先公司字典 -> 后全局字典
 * 4、公司字典可以覆盖全局字典
 * </p>
 */
@Getter
@Setter
@ApiModel("字典项表")
@TableName(autoResultMap = true)
public class SysDicItem extends AutoEntity {

    @ForeignKey(SysDicCode.class)
    @ColumnComment("字典码id")
    @ApiModelProperty(value = "字典码id")
    @TableField
    private Long dicCodeId;

    @ColumnComment("排序值")
    @ApiModelProperty(value = "排序值")
    @TableField
    private int order;
}
